package com.cjl.learn.postProcessor;

import com.cjl.learn.bean.Bird;
import com.cjl.learn.bean.Fish;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * Created by Enzo Cotter on 2019-07-21.
 */
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {


    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
//        Bird bird = (Bird) beanFactory.getBean("bird");

        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("bird");
//        beanDefinition.getPropertyValues().addPropertyValue();
//        beanDefinition.getPropertyValues().addPropertyValue("name", "lily");
//        Bird bird2 = (Bird) beanFactory.getBean("bird");
//        System.out.println(bird2);

        System.out.println("MyBeanFactoryPostProcessor。。。。postProcessBeanFactory");
    }
}
